package com.zxh.blog.service.impl;

import com.zxh.blog.dao.UserDao;
import com.zxh.blog.domain.User;
import com.zxh.blog.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	UserDao userDao;

	public User findUserByUserName(String userName) {
		User user = userDao.selectUserByUserName(userName);
		return user;
	}

	public Integer addUser(User user) {
		Integer integer = userDao.addUser(user);
		return integer;
	}

	public void updateUser(User user) {
		userDao.updateUser(user);
	}

	public void deleteByIds(int[] ids) {
		userDao.deleteByIds(ids);
	}

	public List<User> selectByList() {
		List<User> users = userDao.selectByList();
		return users;
	}

	public void delRoleByUserId(int userId) {
		userDao.delRoleByUserId(userId);
	}

	public Integer insertUserRole(int userId, int roleId) {
		Integer insert = userDao.insertUserRole(userId,roleId);
		return insert;
	}
}
